Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
has-to-string-tag-x
Advanced tools
The has-to-string-tag-x npm package is a utility that checks if an object has the `@@toStringTag` property. This property is used to customize the default string description of an object.
Check if an object has a toStringTag property
This feature allows you to check if an object has the `@@toStringTag` property. In the example, the object `obj` has a custom `toStringTag` property, so the function returns `true`.
const hasToStringTag = require('has-to-string-tag-x');
const obj = { [Symbol.toStringTag]: 'Custom' };
console.log(hasToStringTag(obj)); // true
Check if an object does not have a toStringTag property
This feature allows you to check if an object does not have the `@@toStringTag` property. In the example, the object `obj` does not have a `toStringTag` property, so the function returns `false`.
const hasToStringTag = require('has-to-string-tag-x');
const obj = {};
console.log(hasToStringTag(obj)); // false
The has-symbols package checks if the runtime environment supports ES6 symbols, which includes the `@@toStringTag` symbol. While it does not specifically check for the presence of the `@@toStringTag` property on an object, it is useful for determining if symbols can be used in the environment.
The is-symbol package checks if a given value is a symbol. This can be used in conjunction with other utilities to determine if an object has a `@@toStringTag` property by checking if the property key is a symbol.
The get-intrinsic package provides access to ECMAScript intrinsic objects, including `Symbol.toStringTag`. It can be used to retrieve the `@@toStringTag` symbol and check if an object has this property.
Tests if ES6 @@toStringTag is supported.
See: 26.3.1 @@toStringTag
Version: 1.4.1
Author: Xotic750 Xotic750@gmail.com
License: MIT
Copyright: Xotic750
module.exports
: boolean
⏏Indicates if Symbol.toStringTag
exists and is the correct type.
true
, if it exists and is the correct type, otherwise false
.
Kind: Exported member
FAQs
Tests if ES6 @@toStringTag is supported.
The npm package has-to-string-tag-x receives a total of 1,209,449 weekly downloads. As such, has-to-string-tag-x popularity was classified as popular.
We found that has-to-string-tag-x demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.